package com.ymatou.promotion.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*获取优惠券批次详情信息接口Call
*FreeMaker Template自动生成代码
*/
public class GetCouponBatchDetailCall extends YmatouBaseCall{
	private static String opurl ="api/Coupon/GetCouponBatchDetail";
	
	public GetCouponBatchDetailCall() {
		super(EnvSetup.getSystemUrl("promition_api_coupon"),opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 * 
	 * @return
	 */
	public String getBCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("BCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取MessageText
	 * 
	 * @return
	 */
	public String getMessageText() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(getReturnData()).getString("Data"))
					.getString("MessageText");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponBatch
	 * 
	 * @return
	 */
	public String getCouponBatch() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(getReturnData()).getString("Data"))
					.getString("CouponBatch");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponBatch
	 * 
	 * @return
	 */
	public String getBatchCode() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("BatchCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取BatchPrefix
	 * 
	 * @return
	 */
	public String getBatchPrefix() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("BatchPrefix");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取SellerId
	 * 
	 * @return
	 */
	public String getSellerId() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("SellerId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponName
	 * 
	 * @return
	 */
	public String getCouponName() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("CouponName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponDesc
	 * 
	 * @return
	 */
	public String getCouponDesc() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("CouponDesc");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponValues
	 * 
	 * @return
	 */
	public String getCouponValues() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("CouponValues");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code.replace("[", "").replace("]", "");
	}
	
	/**
	 * 获取CouponUseType
	 * 
	 * @return
	 */
	public String getCouponUseType() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponValues())
					.getString("CouponUseType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponValue
	 * 
	 * @return
	 */
	public String getCouponValue() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponValues())
					.getString("CouponValue");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponUseType
	 * 
	 * @return
	 */
	public String getOrderValue() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponValues())
					.getString("OrderValue");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取MaxSendNum
	 * 
	 * @return
	 */
	public String getMaxSendNum() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("MaxSendNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponBatch
	 * 
	 * @return
	 */
	public String getUserMaxReceiveNum() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("UserMaxReceiveNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ValidStart
	 * 
	 * @return
	 */
	public String getValidStart() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("ValidStart");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ValidEnd
	 * 
	 * @return
	 */
	public String getValidEnd() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponBatch())
					.getString("ValidEnd");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
}